<?php

namespace app\common\model\mycurrency;

use addons\mycurrency\library\Common;
use think\Model;
use traits\model\SoftDelete;

class DataArticle extends Model
{

    //use SoftDelete;

    

    // 表名
    protected $name = 'mycurrency_data_article';

    const STATUS_XIANSHI = 1;//状态 显示
    const STATUS_YINCANG = 2;//状态 隐藏



    public function getImageAttr($value){
        $baseUrl = Common::GetHost();
        return $baseUrl . $value;
    }

    public function getCreatetimeAttr($value){
        return $value != null ? date('Y-m-d H:i:s', $value) : '';
    }

    public function getImagesAttr($value){
        $all = explode(',',$value);
        $baseUrl = Common::GetHost();
        foreach($all as $k => $v){
            $all[$k] = $baseUrl . $v;
        }
        return $all;
    }



    public function classification()
    {
        return $this->belongsTo('DataArticleClassification', 'article_class_id', 'id', [], 'LEFT')->setEagerlyType(0);
    }
}
